home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / file / logiso.000 / logiso / Utils / RCS / logiso_copy,v < prev    next >
Encoding:
Text File  |  1995-03-24  |  5.1 KB  |  269 lines

  1. head    1.6;
  2. access;
  3. symbols
  4.     VER_0_3:1.6
  5.     VER_0_2:1.5;
  6. locks; strict;
  7. comment    @# @;
  8.  
  9.  
  10. 1.6
  11. date    95.03.24.11.43.35;    author coulter;    state Exp;
  12. branches;
  13. next    1.5;
  14.  
  15. 1.5
  16. date    95.03.10.02.42.22;    author coulter;    state Exp;
  17. branches;
  18. next    1.4;
  19.  
  20. 1.4
  21. date    95.03.01.07.10.23;    author coulter;    state Exp;
  22. branches;
  23. next    1.3;
  24.  
  25. 1.3
  26. date    95.02.19.17.53.11;    author coulter;    state Exp;
  27. branches;
  28. next    1.2;
  29.  
  30. 1.2
  31. date    95.02.19.16.06.41;    author coulter;    state Exp;
  32. branches;
  33. next    1.1;
  34.  
  35. 1.1
  36. date    95.02.18.08.36.38;    author coulter;    state Exp;
  37. branches;
  38. next    ;
  39.  
  40.  
  41. desc
  42. @copy the logged files to the hard disk.
  43. @
  44.  
  45.  
  46. 1.6
  47. log
  48. @Checkin version for 0.3 distribution.
  49. @
  50. text
  51. @#! /bin/ksh
  52. USAGE='USAGE: logiso_copy [ -d config_prefix ]
  53.    Get the iso log and install the logged files on the hard disk.
  54.  
  55. USAGE: logiso_preview  [ -d config_prefix ]
  56.    List the files that would have been installed by logiso_copy.
  57.  
  58. If -d is specified, then the config file, ${drive_or_mirror_prefix}config
  59. is used instead of config.  This allows a set of config files to be defined
  60. one for each unique combination of cd-rom mount point and mirror directory
  61. for users with multiple cd-rom drives or who what to populate different
  62. mirror directories, e.g. to mirror different cd-rom volumes.
  63. '
  64. # (C) Copyright 1995 by Michael Coulter.  All rights reserved.
  65.  
  66. # Process parameters
  67.  
  68.       COMMAND="$(basename "$0")"
  69.       CONFIG_PREFIX=""
  70.       if [ $# -eq 2 -a "$1" = "-d" ]
  71.       then
  72.          shift  # done with -d
  73.          CONFIG_PREFIX="$1"; shift
  74.       fi
  75.       if [ $# -ne 0 ]
  76.       then
  77.          echo "$USAGE" >&2
  78.          echo "Expected zero or 2 arguments, got $#" >&2
  79.          exit 1
  80.       fi
  81.  
  82. # Set variables
  83.  
  84.    ISOFS_UTIL_DIR="${ISOFS_UTIL_DIR:-/usr/src/linux/fs/isofs/Utils}"
  85.  
  86. # Source in user definitions
  87. # MOUNT_PATH
  88. # MAP_TO_PATH
  89. # CD_FILE
  90.  
  91.    CONFIG_FILE="${ISOFS_UTIL_DIR}/${CONFIG_PREFIX}config"
  92.    if [ ! -r "$CONFIG_FILE" ]
  93.    then
  94.       echo "Unable to find config file, $CONFIG_FILE" >&2
  95.       exit 1
  96.    fi
  97.    . "${ISOFS_UTIL_DIR}/${CONFIG_PREFIX}config"
  98.    export ISOFS_UTIL_DIR
  99.  
  100. # Set up temp files
  101.  
  102.     INODE_LIST="/tmp/logisoina$$"
  103.     INSTALL_LIST="/tmp/logisoinb$$"
  104.     trap "rm -f $INODE_LIST $INSTALL_LIST" 0 1 2 3 15
  105.  
  106. # Define standard functions
  107.  
  108.    . "$ISOFS_UTIL_DIR/ksh_fns"
  109.  
  110. # Check for root if doing copy
  111.  
  112.    if [ "$COMMAND" = "logiso_copy" ]
  113.    then
  114.       if [ "$(id -u)" -ne 0 ]
  115.       then
  116.      echo "$USAGE" >&2
  117.      echo "You are not root. Do you want to continue (type y for yes)?" >&2
  118.      read RESPONSE
  119.      if [ "$RESPONSE" != "y" ]
  120.      then
  121.         exit 1
  122.      fi
  123.       fi
  124.    fi
  125.  
  126.  
  127. # Do it
  128.  
  129.    logiso_get "$MOUNT_PATH" | cut -f1 | sort -n | uniq >  "$INODE_LIST"
  130.    rm -f "$ISOFS_UTIL_DIR/last_inodes"  2> /dev/null
  131.    cp "$INODE_LIST" "$ISOFS_UTIL_DIR/last_inodes"
  132.  
  133. # If CD_FILES does not exist, create it.
  134.  
  135.    USE_GZIP="FALSE"
  136.    if [ -f "${CD_FILES}.gz" -a ! -f "$CD_FILES" ]
  137.    then
  138.       USE_GZIP="TRUE"
  139.       echo "Uncompressing $CD_FILES"
  140.       gunzip < "${CD_FILES}.gz" > "$CD_FILES"
  141.    fi
  142.    if [ ! -f "$CD_FILES" ]
  143.    then
  144.       echo "$CD_FILES does not exist."
  145.       echo "Creating it will take a while."
  146.       find  "$MOUNT_PATH" 2> /dev/null | xargs ls -i -d 2> /dev/null     \
  147.      | sort -n > "$CD_FILES" 2> /dev/null
  148.       check_return 0 1 "Error making $CD_FILE"
  149.       echo "You should probably clear the log and try again." >&2
  150.       exit 1
  151.    fi
  152.  
  153. # Compare logged files against cd_files.
  154.  
  155.    echo "Comparing logged inodes against list in $CD_FILES"
  156.    process_lists "$INODE_LIST" "$CD_FILES" > "$INSTALL_LIST"
  157.  
  158.    if [ "$COMMAND" = "logiso_copy" ]
  159.    then
  160.       ##echo logiso_copy: do install
  161.       cp "$INSTALL_LIST" "$ISOFS_UTIL_DIR/last_install"
  162.       ## echo logiso_copy: install_list -d "$CONFIG_PREFIX" "$INSTALL_LIST" "$MOUNT_PATH" "$MAP_TO_PATH"
  163.       install_list -d "$CONFIG_PREFIX" "$INSTALL_LIST" "$MOUNT_PATH" "$MAP_TO_PATH"
  164.    else
  165.       ##echo logiso_copy: do preview
  166.       cat "$INSTALL_LIST"
  167.    fi   
  168.  
  169. # If we uncompressed the cd_files, file, remove the uncompressed copy.
  170.  
  171.    if [ "$USE_GZIP" = "TRUE" ]
  172.    then
  173.       rm -f "$CD_FILES"
  174.    fi
  175. @
  176.  
  177.  
  178. 1.5
  179. log
  180. @Checkin files modified to make version 0.2
  181. @
  182. text
  183. @d14 1
  184. @
  185.  
  186.  
  187. 1.4
  188. log
  189. @Checkpoint files.  Can now compress cd_files.
  190. @
  191. text
  192. @d1 2
  193. a2 2
  194. #! /bin/bash
  195. USAGE='USAGE: logiso_copy
  196. d4 9
  197. d17 7
  198. d27 1
  199. a27 1
  200.          echo "Too many arguments." >&2
  201. d40 7
  202. a46 1
  203.    . "${ISOFS_UTIL_DIR}/config"
  204. d59 1
  205. a59 1
  206. # Check for root
  207. d61 1
  208. a61 1
  209.    if [ "$EUID" -ne 0 ]
  210. d63 1
  211. a63 4
  212.       echo "$USAGE" >&2
  213.       echo "You are not root. Do you want to continue (type y for yes)?" >&2
  214.       read RESPONSE
  215.       if [ "$RESPONSE" != "y" ]
  216. d65 7
  217. a71 1
  218.      exit 1
  219. d79 1
  220. d89 1
  221. a89 1
  222.       gunzip "${CD_FILES}.gz"
  223. d106 14
  224. a119 2
  225.    cp "$INSTALL_LIST" "$ISOFS_UTIL_DIR/last_install"
  226.    install_list "$INSTALL_LIST" "$MOUNT_PATH" "$MAP_TO_PATH"
  227. d122 1
  228. a122 2
  229.       echo "Compressing $CD_FILES"
  230.       gzip "${CD_FILES}"
  231. @
  232.  
  233.  
  234. 1.3
  235. log
  236. @Get log before creating cd_files.
  237. @
  238. text
  239. @d50 6
  240. d58 7
  241. d76 1
  242. a76 1
  243. # Do it
  244. a77 2
  245.    logiso_get "$MOUNT_PATH" | cut -f1 | sort -n | uniq >  "$INODE_LIST"
  246.    cp "$INODE_LIST" "$ISOFS_UTIL_DIR/last_inodes"
  247. d82 5
  248. @
  249.  
  250.  
  251. 1.2
  252. log
  253. @Checkpoint version 0.1
  254. @
  255. text
  256. @d59 2
  257. @
  258.  
  259.  
  260. 1.1
  261. log
  262. @Checkpoint version before fixing /usr/bin install
  263. @
  264. text
  265. @d63 1
  266. a63 1
  267.    logiso_get | cut -f1 | sort -n | uniq >  "$INODE_LIST"
  268. @
  269.